package net.huashitong.Project.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.Project.dao.ProjectCollectionDao;
import net.huashitong.Project.entity.ProjectCollection;
import net.huashitong.Project.filter.ProjectCollectionFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectCollectionService extends StringPKService<ProjectCollection> {

    @Autowired
    private ProjectCollectionDao dao;
    @Autowired
    private SysTableService tableService;

    @Override
    protected BaseDao<ProjectCollection, String> getDao() {
        return dao;
    }

    @Override
    protected void beforeSave(ProjectCollection obj) {
        obj.setSysId(tableService.updateMaxSysId("t_keyan_collection", null));
    }


    public List<ProjectCollection> queryByFilter(ProjectCollectionFilter filter){
        return dao.queryByFilter(filter);
    }

    public List<ProjectCollection> queryByProjectIdAndUser(String projectId, String userId){
        return dao.queryByProjectIdAndUser(projectId, userId);
    }

    public List<ProjectCollection> queryAll(){
        return dao.queryAll();
    }
}
